package com.bayihouse.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bayihouse.model.excel.publicClass.BaseTwoEntity;
import com.bayihouse.model.excel.publicClass.father.BaseEntity;
import com.bayihouse.utils.MyObjectUtils;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

/**
 * @TableName community
 */
@TableName(value = "community")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class Community extends BaseTwoEntity<House, Room> implements Serializable {
    /**
     * 社区地址
     */
    private String address;

    private String detail;

    private Date createTime;

    @TableField("father_id")
    private Long netId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public void setTId() {
        if (super.checkIsEmptyTList()) {
            return;
        }
        super.tlist.stream().forEach(child -> {
            child.setCommunityId(super.id);
        });
    }

    @Override
    public void setVId() {
        if (super.checkIsEmptyVList()) {
            return;
        }
        super.vlist.forEach(child -> {
            child.setCommunityId(super.id);
        });
    }
}